package com.app.web.order;

import com.app.base.BaseDao;
import com.app.web.jst.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

public interface OrderDao extends BaseDao {
    /**
     * 购买订单信息
     * @param map
     */
    void order(Map map);

    /**
     * 修改订单状态
     * @param status
     * @param sns
     */
    int orderChange(@Param("status") int status,@Param("sns") List<String> sns);

    /**
     * 修改订单分佣明细状态
     * @param status
     * @param order_sn
     */
    int orderExceptChange(@Param("status") int status,@Param("order_sn") String order_sn);

    //获取订单列表
    List<Map<String,Object>> getGoodsOrderList(Map map);

    //将结算订单同步到成功订单表
    void orderSuccessSync(@Param("orders") List<Map<String,Object>> orders);

    //记录退款申请信息
    void cancelApply(@Param("uid")long uid,@Param("order_status")int order_status,@Param("order_sn")String order_sn,@Param("reason")String reason);
    int cancel(@Param("order_sn")String order_sn,@Param("express_name")String express_name,@Param("express_no")String express_no);

    //退货退款-订单信息

    Map<String,Object> getOrder(String order_sn);
    //退货退款-订单信息
    @Select("select reason,express_name,express_no,status cancel_status,DATE_FORMAT(cancel_time,'%Y-%m-%d %H:%i:%s') as cancel_time from t_goods_order_cancel where order_sn=#{order_sn}")
    Map<String,Object> getOrderCancel(String order_sn);

    //我的订单列表
    List<Map<String,Object>> getUidOrderList(Map map);
    //订单列表
    List<Map<String,Object>> getOrderList(Map<String,Object> map);

    void orderJst(Map<String, Object> order);

    Map<String,Object> getOrderInfo(@Param("id")long id);

    @Select("select name,addrInfo,phone,province,city,county FROM t_user_address WHERE id=#{id} and uid=#{uid}")
    Map<String,Object> addrInfo(@Param("uid")long uid,@Param("id") long id);

    /**
     * 更新订单物流
     */
    int orderSync(Map<String,Object> map);
}
